﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Best.SmartCms.API.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Attachment",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    StorageType = table.Column<int>(nullable: false),
                    FileLenth = table.Column<long>(nullable: false),
                    FileExt = table.Column<string>(maxLength: 50, nullable: true),
                    FileName = table.Column<string>(maxLength: 50, nullable: true),
                    OssKey = table.Column<string>(maxLength: 50, nullable: true),
                    SourceId = table.Column<string>(maxLength: 50, nullable: true),
                    SourceType = table.Column<int>(nullable: false),
                    CreatedTime = table.Column<DateTime>(nullable: true),
                    CreatorId = table.Column<string>(maxLength: 50, nullable: true),
                    CreatorName = table.Column<string>(maxLength: 50, nullable: true),
                    UpdatedTime = table.Column<DateTime>(nullable: true),
                    UpdatorId = table.Column<string>(maxLength: 50, nullable: true),
                    UpdatorName = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Attachment", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BusinessSystem",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Code = table.Column<string>(maxLength: 50, nullable: true),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    AccessKey = table.Column<string>(maxLength: 200, nullable: true),
                    Secret = table.Column<string>(maxLength: 200, nullable: true),
                    RemoteUrl = table.Column<string>(maxLength: 250, nullable: true),
                    CreatedTime = table.Column<DateTime>(nullable: true),
                    CreatorId = table.Column<string>(maxLength: 50, nullable: true),
                    CreatorName = table.Column<string>(maxLength: 50, nullable: true),
                    UpdatedTime = table.Column<DateTime>(nullable: true),
                    UpdatorId = table.Column<string>(maxLength: 50, nullable: true),
                    UpdatorName = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BusinessSystem", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "checkdb",
                columns: table => new
                {
                    Gid = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_checkdb", x => x.Gid);
                });

            migrationBuilder.CreateTable(
                name: "User",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Code = table.Column<string>(maxLength: 50, nullable: true),
                    UserName = table.Column<string>(maxLength: 50, nullable: true),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Password = table.Column<string>(maxLength: 250, nullable: true),
                    PasswordSalt = table.Column<string>(maxLength: 100, nullable: true),
                    Mail = table.Column<string>(maxLength: 50, nullable: true),
                    Phone = table.Column<string>(maxLength: 50, nullable: true),
                    Faxes = table.Column<string>(maxLength: 50, nullable: true),
                    QQ = table.Column<string>(maxLength: 50, nullable: true),
                    WeixinId = table.Column<string>(maxLength: 50, nullable: true),
                    WeixinOpenId = table.Column<string>(maxLength: 50, nullable: true),
                    WeixinUnionId = table.Column<string>(maxLength: 50, nullable: true),
                    IdCard = table.Column<string>(maxLength: 50, nullable: true),
                    Sex = table.Column<short>(nullable: false),
                    Remark = table.Column<string>(maxLength: 500, nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    UserType = table.Column<int>(nullable: false),
                    DeviceNo = table.Column<string>(maxLength: 50, nullable: true),
                    Referee = table.Column<string>(maxLength: 50, nullable: true),
                    CreatedTime = table.Column<DateTime>(nullable: true),
                    CreatorId = table.Column<string>(maxLength: 50, nullable: true),
                    CreatorName = table.Column<string>(maxLength: 50, nullable: true),
                    UpdatedTime = table.Column<DateTime>(nullable: true),
                    UpdatorId = table.Column<string>(maxLength: 50, nullable: true),
                    UpdatorName = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_User", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Attachment");

            migrationBuilder.DropTable(
                name: "BusinessSystem");

            migrationBuilder.DropTable(
                name: "checkdb");

            migrationBuilder.DropTable(
                name: "User");
        }
    }
}
